import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int testCases = Integer.parseInt(br.readLine().trim());
		while(testCases-- != 0) {
			int n = Integer.parseInt(br.readLine().trim());
			Integer[] a = new Integer[n * 2];
			
			for(int i = 0; i < 2 * n;) {
				String str = br.readLine();
				StringTokenizer sToken = new StringTokenizer(str, " ");
				a[i++] = Integer.parseInt(sToken.nextToken());
				a[i++] = -Integer.parseInt(sToken.nextToken());
			}
			
			
			Arrays.sort(a, new Comparator<Integer>() {
				@Override
				public int compare(Integer o1, Integer o2) {
					return Math.abs(o1) - Math.abs(o2);
				}
			});
			
			int max = 0;
			int count = 0;
			for(int i = 0; i < a.length; i++) {
				if(a[i] >= 0) {
					count++;
				} else {
					count--;
				}
				max = Math.max(max, count);
			}
			
			System.out.println(max);
			
		}
	}

}
